home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / lcppb.zip / LCPPANS.ZIP / PRMPT.CPP < prev    next >
C/C++ Source or Header  |  1991-07-08  |  609b  |  28 lines

  1. // prmpt.cpp -- Prompt for value between 1 and 100
  2.  
  3. #include <iostream.h>
  4.  
  5. main()
  6. {
  7.   int goodResponse = 0;
  8.   int response;
  9.  
  10.  
  11.   while (!goodResponse) {
  12.     cout << "Enter value from 1 to 100: ";
  13.     cin >> response;
  14.     goodResponse = ((1 <= response) && (response <= 100));
  15.     if (!goodResponse)
  16.       cout << "ERROR: Try again!\n";
  17.   }
  18.   cout << "Final value == " << response;
  19. }
  20.  
  21.  
  22. // Copyright (c) 1990 by Tom Swan. All rights reserved
  23. // Revision 1.00    Date: 10/24/1990   Time: 07:10 am
  24.  
  25. // Revision 1.01    Date: 07/08/1991   Time: 05:41 pm
  26. // Converted for Borland C++ 2.0
  27.  
  28.